

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <meta name="layout" content="main" />
        <title>Show Consistency Errors</title>
    </head>
    <body>
        <div class="nav">
            <span class="menuButton"><a class="home" href="${createLinkTo(dir:'')}">Home</a></span>
            <span class="menuButton"><g:link class="list" action="list">Graph List</g:link></span>
        </div>
        <div class="body">
            <h1>Show Graph Errors</h1>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            
            <g:form action="save" method="post" enctype="multipart/form-data">
             <g:if test="${err}">
                <div class="dialog">
                 <h2>Graph Errors</h2>  
				  <table>
                    <tbody>
                    	<g:if test="${graph.isCyclic()}">
				            <tr class="prop">
				                 <td>The graph is cyclic !</td>
				            </tr>
				        </g:if> 
				    </tbody>
                  </table> 
                  
                  <h2>Node Errors</h2>
                  
                  <table>
                    <tbody>   
                        <g:each in="${graph.vertexSet()}" status="i" var="node">
				            <g:if test="${node.vertexCapacityError}">
				            	<tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
				                      <td>The vertex capacity of node ${node.label?.encodeAsHTML()} isn't in the range of [0,1]</td>
				                </tr>
				            </g:if>
				            <g:if test="${node.incomingLinksError}">
				            	<tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
				                      <td>The sum of the weights of the incoming links in node ${node.label?.encodeAsHTML()} isn't equal to 1</td>
				                </tr>
				            </g:if>

				           <g:if test="${node.rootError}">
				            	<tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
				                      <td>The node ${node.label?.encodeAsHTML()} has no outgoing links but it is not a root (only one root per graph admitted!)</td>
				                </tr>
				            </g:if>

				            <g:if test="${node.multipleLinksError}">
				            	<tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
				                      <td>The node ${node.label?.encodeAsHTML()} has multiple links entering in it</td>
				                </tr>
				            </g:if>
				            <g:if test="${node.unconnectedError}">
				            	<tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
				                      <td>The node ${node.label?.encodeAsHTML()} has no incoming neither outgoing links</td>
				                </tr>
				            </g:if>
				            <g:if test="${node.alias}">
				            	<tr class="${(i % 2) == 0 ? 'odd' : 'even'}">				             
				                      <td>The (external) Id ${node.label?.encodeAsHTML()} has been already used for another node in this graph</td>
				                </tr>
				            </g:if>

                    	</g:each>
                    </tbody>
                  </table>
                  
                  <h2>Edge Errors</h2>
                  
                  <table>
                    <tbody> 
                    	<g:each in="${graph.edgeSet()}" status="t" var="edge">
				            <g:if test="${edge.weight_error}">
				            	<tr class="${(t % 2) == 0 ? 'odd' : 'even'}">
				                      <td>The weight of the link ${edge.id?.encodeAsHTML()} is not in the range of [0,1]</td>
				                </tr>
				            </g:if>
				            <g:if test="${edge.threshold_error}">
				            	<tr class="${(t % 2) == 0 ? 'odd' : 'even'}">
				                      <td>The threshold of the link ${edge.id?.encodeAsHTML()} is not in the range of [0,1]</td>
				                </tr>
				            </g:if>
				            <g:if test="${edge.alias}">
				            	<tr class="${(t % 2) == 0 ? 'odd' : 'even'}">
				                      <td>The Id "${edge.id?.encodeAsHTML()}" has been already used for another link in this graph</td>
				                </tr>
				            </g:if>
                    	</g:each>
                    	
                    </tbody>
                  </table>
                 </div>
                </g:if>
                <g:else>
                	<h2>Correct Graph !</h2>
                	The graph is correct: you can upload it !!
                </g:else>
                
               <div class="buttons">
                     <g:form controller="graph">
                     		<input type="file" id="file" name="file" value="Select" size="50"/>
                        	<span class="button"><input class="save" type="submit" action="Create" value="Save" /></span>
                     </g:form>
              </div>
                
            </g:form>

        </div>
    </body>
</html>

